<?php
class Db extends Config{
	
	function __construct(){
		global $mosConfig_host, $mosConfig_db, $mosConfig_user, $mosConfig_password;
		$this->conn = mysql_connect($mosConfig_host,$mosConfig_user,$mosConfig_password) or die(mysql_error());
		mysql_select_db($mosConfig_db) or die($mosConfig_db);
	}
	
	function get_cur_db(){
		$res = mysql_query("SELECT DB_NAME() AS DBName");
		$row = mysql_fetch_array($res);
		return "Current Database: ".($row['DBName'] ? $row['DBName']: 'No database returned');
	}
	
	function connect(){
		$this->conn = mysql_connect($this->host,$this->db_user,$this->db_password) or die(mysql_error());
		mysql_select_db($this->db_name);
	}
	
	function close_connection(){
		mysql_close($this->conn);
	}
}
?>